import request from '@/utils/request'

// 根据挂号ID查询未支付的处方信息及详情
export function getNoChargeCareHistoryByRegId(regId) {
    return request({
        url: '/charge/Registration/getNoChargeCareHistoryByRegId/' + regId,
        method: 'get'
    })
}

// 处方收费里面的现金支付
export function createOrderChargeWithCash(data) {
    return request({
        url: '/charge/Registration/createOrderChargeWithCash',
        method: 'post',
        data
    })
}

// 处方收费里面的支付宝支付
export function createOrderChargeWithZfb(data) {
    // let xhr=new XMLHttpRequest();
    // xhr.open('POST',"http://192.168.1.43:7000/charges/api/alipay/pay",true,data);
    // xhr.setRequestHeader("token",sessionStorage.getItem("token"));
    // xhr.send();
    // window.open("/charges/api/alipay/pay")
    return request({
        url: '/charges/api/pay/alipay',
        method: 'post',
        data
    })
}

// 根据订单ID查询订单信息【验证是否支付成功】
export function queryOrderChargeOrderId(orderId) {
    return request({
        url: '/charge/api/pay/queryOrderChargeOrderId/'+orderId,
        method: 'get'
    })
}

// 分页查询所有的订单
export function queryAllOrderChargeForPage(data) {
    return request({
        url: '/charge/Registration/queryAllOrderChargeForPage',
        method: 'post',
        data
    })
}

// 根据订单ID查询订单详情
export function queryOrderChargeItemByOrderId(orderId) {
    return request({
        url: '/charge/Registration/queryOrderChargeItemByOrderId/' + orderId,
        method: 'get'
    })
}

// 根据订单ID返回订单支付地址和总金额
export function toPayOrderWithZfb(orderId) {
    return request({
        url: '/charges/api/pay/toPayOrderWithZfb/' + orderId,
        method: 'get'
    })
}

// 现金支付
export function payWithCash(orderId) {
    return request({
        url: `/charge/Registration/payWithCash/${orderId}`,
        method: 'get'
    })
}


//

